package org.easy.chatai;

import org.easy.chatai.model.AiMessage;
import org.easy.chatai.model.ChatModelResponse;
import org.easy.sse.SseRestTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;


@Configuration
@EnableConfigurationProperties
public class ChatAiAutoConfiguration {


    @Bean
    public ChatAiTemplate chatAiTemplate() {
        return new ChatAiTemplate(new ChatAiClient(), new SseRestTemplate());
    }


    public static void main(String[] args) {
        ChatAiTemplate chatAiTemplate = new ChatAiTemplate(new ChatAiClient(), new SseRestTemplate());

        List<AiMessage> histories = new ArrayList<>();
        ChatModelResponse sss = chatAiTemplate.chatBlocking("https://ark.cn-beijing.volces.com/api/v3/chat/completions",
                "03a3f7ea-a462-4696-be2a-d80a2b28e693",
                "ep-20241228093508-6xwjf",
                histories);
        System.out.println(sss);
    }


}
